<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .inp {
            position: relative;
            width: 170px;
            height: 30px;
            margin: 0 0 10px 0;
            background-color: pink;
            font-size: 23px;
            line-height: 30px;
            display: none;
            /* white-space: normal;
            overflow: hidden;
            text-overflow: ellipsis; */
        }

        .inp::after {
            content: '';
            position: absolute;
            bottom: -19px;
            display: block;
            width: 0;
            height: 0;
            border: 10px solid transparent;
            border-top: 10px solid black;
        }
    </style>
</head>

<body>
    <div>
        <div class="inp"></div>
        <input type="text">
    </div>
    <script>
        var inp = document.querySelector('.inp')
        var ipt = document.querySelector('input')
        console.log(inp);
        ipt.addEventListener('keyup', function (e) {
            // console.log(this.value);
            if (ipt.value == '') {
                inp.style.display = 'none'
            } else {
                inp.innerHTML = this.value
                inp.style.display = 'block'
            }
        })
        ipt.addEventListener('blur', function () {
            if (ipt.value == '') {
                inp.style.display = 'none'
            } else {

                inp.style.display = 'block'
            }
        })
    </script>
</body>

</html>